import {BASE_URL} from './config.js'
export function request(options,isshowloaing=true){
  if(isshowloaing){
    uni.showLoading({
      title:"数据请求中..."
    })
  }
  return new Promise((resolve,reject)=>{
    uni.request({
      url:BASE_URL+options.url,
      method:options.method || "GET",
      success:(res)=>{
        resolve(res)
      },
      fail:(err)=>{
        reject(err)
      },
      complete:()=>{
        uni.hideLoading()
      }
    })
  }).catch(err=>err)
}